package com.edu.exam.enums.grading;

import com.edu.exam.enums.core.BaseEnum;

import java.util.Arrays;

/**
 * 字体样式枚举
 * 管理批注系统中各种字体样式
 *
 * @author System
 * @version 1.0.0
 */
public enum FontStyle implements BaseEnum {

    // === 基础字体样式 ===
    NORMAL("NORMAL", "正常"),
    BOLD("BOLD", "粗体"),
    ITALIC("ITALIC", "斜体"),
    UNDERLINE("UNDERLINE", "下划线"),

    // === 组合字体样式 ===
    BOLD_ITALIC("BOLD_ITALIC", "粗斜体"),
    BOLD_UNDERLINE("BOLD_UNDERLINE", "粗体下划线"),
    ITALIC_UNDERLINE("ITALIC_UNDERLINE", "斜体下划线"),
    BOLD_ITALIC_UNDERLINE("BOLD_ITALIC_UNDERLINE", "粗斜体下划线"),

    // === 特殊字体样式 ===
    STRIKETHROUGH("STRIKETHROUGH", "删除线"),
    DOUBLE_UNDERLINE("DOUBLE_UNDERLINE", "双下划线"),
    DOTTED_UNDERLINE("DOTTED_UNDERLINE", "点状下划线"),
    DASHED_UNDERLINE("DASHED_UNDERLINE", "虚线下划线"),
    WAVE_UNDERLINE("WAVE_UNDERLINE", "波浪下划线"),

    // === 文字效果样式 ===
    SHADOW("SHADOW", "阴影"),
    OUTLINE("OUTLINE", "轮廓"),
    EMBOSS("EMBOSS", "浮雕"),
    ENGRAVE("ENGRAVE", "雕刻"),
    GLOW("GLOW", "发光"),
    REFLECTION("REFLECTION", "倒影"),

    // === 文字装饰样式 ===
    OVERLINE("OVERLINE", "上划线"),
    BLINK("BLINK", "闪烁"),
    SMALL_CAPS("SMALL_CAPS", "小型大写字母"),
    ALL_CAPS("ALL_CAPS", "全部大写"),
    SUPERSCRIPT("SUPERSCRIPT", "上标"),
    SUBSCRIPT("SUBSCRIPT", "下标");

    private final String code;
    private final String description;

    FontStyle(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static FontStyle fromCode(String code) {
        return Arrays.stream(values())
                .filter(e -> e.getCode().equals(code))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Unknown font style code: " + code));
    }
    @Override
    public String toString() {
        return description;
    }
}